<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page isErrorPage="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt" %>
<t:layout_admin>
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/tabcontent.css"/>">
    <script type="text/javascript" src="<c:url value="/resources/js/tabcontent.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/resources/js/checkinput.js"/>"></script>
    <!-- TinyMCE -->
    <!-- /TinyMCE -->
    <!--
    {if isset($founduser) && $founduser==2}
        <script language="JavaScript">
            alert('Email đã đã đăng ký');
            setTimeout("top.location.href = '/admin/user'",0);
        </script>
    {/if}
    -->
    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td class="bgtitle">
                <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                    <tr>
                        <td width="20">
                            <img src="<c:url value="/resources/images/mui_ten.gif"/>"></td>
                        <td valign="bottom" class="title">Danh sách người dùng</td>
                        <td width="10" valign="bottom">&nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>     
        <tbody>
            <tr>
                <td valign="top">
                    <table width="100%" style="border-collapse: collapse" border="0" cellpadding="0" cellspacing="0">
                    </table>
                    <br>
                    <!-- 3 menu cố định -->
                    <div id="pettabs" class="indentmenu">
                        <ul>
                            <li>
                                <a href="#" rel="dog1" class="selected">
                                    <strong>Khách hàng</strong>
                                </a>
                            </li>
                            <li>
                                <a href="#" rel="dog2" class="">
                                    <strong>Nhân viên</strong>
                                </a>
                            </li>
                            <li>
                                <a href="#" rel="dog3" class="">
                                    <strong>Thêm thành viên</strong>
                                </a>
                            </li>
                        </ul>
                        <br style="clear: left">
                    </div>
                    <div style="border:1px solid #CCCCCC; width:960px; padding-bottom:0px; padding-left:0px; padding-right:0px; padding-top:0px;">
                        <!-- Dog 1, chèn nội dung vào đây --->
                        <div id="dog1" class="tabcontent" style="display: block;">
                            <!--hiện thị sản phẩm-->
                            <style type="text/css">

                                #color{
                                    -moz-column-wibth:4px;
                                    -webkit-column-width:4px;
                                    -moz-column-gap:1px;
                                    -webkit-comlum-gap:1px;
                                    -moz-column-gap:1px solid red;
                                    -webkit-column-gap:1px solid red;
                                    -webkit-column-count:7;
                                }    

                            </style>   
                            <!--form them san pham-->
                            <form action="/login" method="post"  style="margin:0; padding:0" onsubmit="return verifyloginForm(this)">

                                <table class="display dataTable" id="example" width='100%' align='center' border='0' cellpadding='2'  cellspacing='0'  style='border-collapse:collapse;font-size:12px; margin-bottom:10px'>
                                    <thead>
                                        <tr>
                                            <th height='30' class='bgmenupro border3' bgcolor='#DDDDDD' style="width:23px!important">
                                    <div align='center'>
                                        <strong>STT</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro border3' bgcolor='#DDDDDD' style="width:160px!important">
                                    <div align='center'>
                                        <strong>Email</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro border3' bgcolor='#DDDDDD' style="width:150px!important">
                                    <div align='center'>
                                        <strong>Họ và tên</strong>
                                    </div>
                                    </th>

                                    <th class='bgmenupro border3' bgcolor='#DDDDDD' style="width:100px!important">
                                    <div align='center'>
                                        <strong>Phone</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro border3' bgcolor='#DDDDDD' style="width:230px!important">
                                    <div align='center'>
                                        <strong>Địa chỉ</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro borderfull' bgcolor='#DDDDDD' style="width:60px!important">
                                    <div align='center'>
                                        <strong>Điểm</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro borderfull' bgcolor='#DDDDDD' width='3%'>
                                    <div align='center'>
                                        <strong>Tùy chỉnh</strong>                     
                                    </div>
                                    </th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        <!--load khách hàng-->

                                        <c:forEach var="nd" varStatus="ndCounter" items="${listNguoiDung}">
                                            <c:if test="${nd.getQuyen().getMaQ()==4}">
                                                <tr>
                                                    <td class='border3'>${ndCounter.count}</td>
                                                    <td class='border3'>${nd.getEmail()}</td>
                                                    <td class='border3'>${nd.getHoTen()}</td>
                                                    <td class='border3'>${nd.getSoDienThoai()}</td>
                                                    <td class='border3'>${nd.getDiaChi()}</td>
                                                    <td class='border3'>${nd.getDiemThuong()}</td>

                                                    <c:if test="${nd.getKhoa()==1}">
                                                        <td class='borderfull' >
                                                            <div align='center'>
                                                                <a href='<c:url value="/admin/editnguoidung/${nd.getMaNd()}"/>'>
                                                                    <img src='<c:url value="/resources/images/deleteuser.png"/>' border='0'>
                                                                </a>
                                                            </div>
                                                        </td>
                                                    </c:if>
                                                    <c:if test="${nd.getKhoa()==0}">
                                                        <td class='borderfull' >
                                                            <div align='center'>
                                                                <a href='<c:url value="/admin/editnguoidung/${nd.getMaNd()}"/>'>
                                                                    <img src='<c:url value="/resources/images/ok.png"/>' border='0' width="16">
                                                                </a>
                                                            </div>
                                                        </td>
                                                    </c:if>
                                                </tr>
                                            </c:if>
                                        </c:forEach>
                                        <!--load xong -->
                                    </tbody>
                                </table>
                                <br>
                                <br>
                            </form>
                            <br />
                            <!-- begin: popup!-->
                            <script language="javascript">
                                /*
                                 Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
                                 Permission granted to Dynamic Drive to feature script in archive
                                 For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
                                 */

                                var win = null;
                                function NewWindow(mypage, myname, w, h, scroll) {
                                    LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
                                    TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
                                    settings =
                                            'height=' + h + ',width=' + w + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'
                                    win = window.open(mypage, myname, settings)
                                }

                            </script>
                            <!-- end: popup!-->
                            <!--/hiện thị sản phẩm-->
                        </div>
                        <!--Dog2,Thêm sản phẩm-->
                        <div id="dog2" class="tabcontent" style="display: none;">

                            <!--form hiện thị nhan vien -->
                            <form:form action="editnguoidung" method="post" onsubmit="return verifyloginForm(this)" modelAttribute="nguoidung">
                                <table class="display dataTable" id="example1" width='100%' align='center' border='0' cellpadding='2'  cellspacing='0' style='border-collapse:collapse;font-size:12px; margin-bottom: 10px'>
                                    <thead>
                                        <tr>
                                            <th height='30' class='bgmenupro border3' bgcolor='#DDDDDD' style="width:23px!important">
                                    <div align='center'>
                                        <strong>STT</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro border3' bgcolor='#DDDDDD' style="width:200px!important">
                                    <div align='center'>
                                        <strong>Email</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro border3' bgcolor='#DDDDDD' style="width:160px!important">
                                    <div align='center'>
                                        <strong>Họ và tên</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro border3' bgcolor='#DDDDDD' style="width:100px!important">
                                    <div align='center'>
                                        <strong>Phone</strong>
                                    </div>
                                    </th>
                                    <th class='bgmenupro border3' bgcolor='#DDDDDD' style="width:180px!important">
                                    <div align='center'>
                                        <strong>Địa chỉ</strong>
                                    </div>
                                    </th>

                                    <th class='bgmenupro borderfull' bgcolor='#DDDDDD' style="width:70px!important">
                                    <div align='center'>
                                        <strong>Loại</strong>                     
                                    </div>
                                    </th>
                                    <th class='bgmenupro borderfull' bgcolor='#DDDDDD' width='3%'>
                                    <div align='center'>
                                        <strong>Tùy chỉnh</strong>                     
                                    </div>
                                    </th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        <!--load nhân viên-->

                                        <c:forEach var="nd" varStatus="ngCounter" items="${listNguoiDung}">
                                            <c:if test="${nd.getQuyen().getMaQ()!=4}">
                                                <tr>
                                                    <td class='border3'>${ngCounter.count}</td>
                                                    <td class='border3'>${nd.getEmail()}</td>
                                                    <td class='border3'>${nd.getHoTen()}</td>
                                                    <td class='border3'>${nd.getSoDienThoai()}</td>
                                                    <td class='border3'>${nd.getDiaChi()}</td>
                                                    <td class='border3'>
                                                        <form:select path="quyen">
                                                            <c:forEach var="quyen" varStatus="quyenCounter" items="${listQuyen}">
                                                                <c:if test="${quyen.getMaQ()!=4}">
                                                                    <c:if test="${quyen.getMaQ()==nd.getQuyen().getMaQ()}">
                                                                        <form:option value="${quyen.getMaQ()}" selected="selected">${quyen.getTenQuyen()}</form:option>
                                                                    </c:if>
                                                                    <c:if test="${quyen.getMaQ()!=nd.getQuyen().getMaQ()}">
                                                                        <form:option value="${quyen.getMaQ()}">${quyen.getTenQuyen()}</form:option>
                                                                    </c:if>

                                                                </c:if>
                                                            </c:forEach>
                                                        </form:select>
                                                        <!--
                                                         <input type="hidden" value="{$u.id}" id=staff_id[{$i-1}] name="staff_id[{$i++ -1}]">
                                                        -->
                                                    </td>
                                                    <c:if test="${nd.getKhoa()==1}">
                                                        <td class='borderfull' >
                                                            <div align='center'>
                                                                <a href='<c:url value="/admin/user/delete/${nd.getMaNd()}"/>'>
                                                                    <img src='<c:url value="/resources/images/deleteuser.png"/>' border='0'>
                                                                </a>
                                                            </div>
                                                        </td>
                                                    </c:if>
                                                    <c:if test="${nd.getKhoa()==0}">
                                                        <td class='borderfull' >
                                                            <div align='center'>
                                                                <a href='<c:url value="/admin/user/delete/${nd.getMaNd()}"/>'>
                                                                    <img src='<c:url value="/resources/images/ok.png"/>' border='0' width="16">
                                                                </a>
                                                            </div>
                                                        </td>
                                                    </c:if>
                                                </tr>
                                            </c:if>
                                        </c:forEach>

                                        <!--load xong -->
                                    </tbody>
                                </table>
                                <br>
                                <br>
                                <div align="center">
                                    <input type="submit" id="staff_save" name="staff_save" value="Lưu CSDL">
                                    <input type="reset" id="staff_reset" name="staff_reset" value="Làm lại">
                                </div>
                            </form:form>
                            <br />
                        </div>
                        <!--Dog2,Thêm sản phẩm xong-->
                        <!-- Dog 3, Thêm user --->
                        <div id="dog3" class="tabcontent" style="display: none;">
                            <!--noi dung cua category-->
                            <form:form action="addnguoidung" method="post" onsubmit="return verifyregisterForm(this)" modelAttribute="nguoidung">				
                                <table width="35%" border="0" align="center" cellpadding="3" cellspacing="0" style="font-family: Tahoma; font-size: 10pt; border-collapse:collapse; padding:10px">
                                    <tbody>
                                        <tr>
                                            <td class="bgtitle" colspan="6">
                                                <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                                                    <tr>
                                                        <td width="20">
                                                            <img src="<c:url value="/resources/images/mui_ten.gif" />"></td>
                                                        <td valign="bottom" class="title">Thêm người dùng</td>
                                                        <td width="10" valign="bottom">&nbsp;</td>
                                                    </tr>
                                                </table>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>  
                                        <tr>
                                            <td width="40%">Địa chỉ email (*) </td>
                                            <td width="60%">
                                                <form:input path="email" type="text" class="box_input" size="24"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top">Họ và Tên (*)</td>
                                            <td>
                                                <form:input path="hoTen" type="text" class="box_input" size="24"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Mật khẩu</td>
                                            <td>

                                                <form:password path="matKhau" class="box_input" value="mpcamera"/>
                                                <input name="matKhau2" type="hidden" class="box_input" id="pass2" value="mpcamera">
                                            </td>

                                        </tr>
                                        <tr>
                                            <td valign="top">CMND (*)</td>
                                            <td>
                                                <form:input path="cmnd" type="text" class="box_input" size="24"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top">Địa chỉ (*)</td>
                                            <td>
                                                <form:input path="diaChi" type="text" class="box_input" size="24"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top">Điện thoại (*)</td>
                                            <td>
                                                <form:input path="soDienThoai" type="text" class="box_input" size="24"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top"><form:label path="gioiTinh">Giới tính</form:label></td>
                                            <td><form:checkbox path="gioiTinh" checked="checked"/> Nam</td>
                                        </tr>
                                        <tr>
                                            <td valign="top">Quyền User
                                            </td>	
                                            <td>
                                                <form:select path="quyen.maQ">
                                                    <c:forEach var="quyen" varStatus="quyenCounter" items="${listQuyen}">
                                                        <c:if test="${quyen.getMaQ()!=1}">
                                                            <form:option value="${quyen.getMaQ()}">${quyen.getTenQuyen()}</form:option>    
                                                        </c:if>
                                                    </c:forEach>
                                                </form:select>
                                            </td>
                                        </tr>									
                                        <tr bgcolor="">
                                            <td valign="top">&nbsp;</td>
                                            <td><table border="0" cellspacing="0" cellpadding="0">
                                                    <tbody>
                                                        <tr>
                                                            <td>
                                                                <input type="submit" name="usercreate" id="usercreate" value="Tạo user">
                                                                <input type="reset" id="staff_reset" name="staff_reset" value="Làm lại">
                                                            </td>
                                                            <td width="10">&nbsp;</td>
                                                            <td>&nbsp;</td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </form:form>
                            <!--load xong catrgory-->
                        </div>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>

    <script type="text/javascript">
        var mypets = new ddtabcontent("pettabs")
        mypets.setpersist(true)
        mypets.setselectedClassTarget("link")
        mypets.init(0)
    </script>
    <br>
</t:layout_admin>
<!---ham tao tab-->
